gtk4-demo: Cosmetics
authorMatthias Clasen <mclasen@redhat.com>
Fri, 1 Jul 2022 04:10:16 +0000 (00:10 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 1 Jul 2022 04:10:16 +0000 (00:10 -0400)
demos/gtk-demo/font_features.c
demos/gtk-demo/font_features.ui

index f907989700e30055201a45eeac9707a1292d58ce..ab0ad76374505ec36f8e7a1bc85d199dff09f176 100644 (file)
@@ -325,7 +325,6 @@ add_check_group (GtkWidget   *box,
 {
   GtkWidget *label;
   GtkWidget *group;
-  PangoAttrList *attrs;
   int i;
 
   group = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
@@ -335,10 +334,7 @@ add_check_group (GtkWidget   *box,
   gtk_label_set_xalign (GTK_LABEL (label), 0.0);
   gtk_widget_set_halign (label, GTK_ALIGN_START);
   g_object_set (label, "margin-top", 10, "margin-bottom", 10, NULL);
-  attrs = pango_attr_list_new ();
-  pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
-  gtk_label_set_attributes (GTK_LABEL (label), attrs);
-  pango_attr_list_unref (attrs);
+  gtk_widget_add_css_class (label, "heading");
   gtk_box_append (GTK_BOX (group), label);
 
   for (i = 0; tags[i]; i++)
@@ -386,7 +382,6 @@ add_radio_group (GtkWidget *box,
   GtkWidget *group;
   int i;
   GtkWidget *group_button = NULL;
-  PangoAttrList *attrs;
 
   group = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
   gtk_widget_set_halign (group, GTK_ALIGN_START);
@@ -395,10 +390,7 @@ add_radio_group (GtkWidget *box,
   gtk_label_set_xalign (GTK_LABEL (label), 0.0);
   gtk_widget_set_halign (label, GTK_ALIGN_START);
   g_object_set (label, "margin-top", 10, "margin-bottom", 10, NULL);
-  attrs = pango_attr_list_new ();
-  pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
-  gtk_label_set_attributes (GTK_LABEL (label), attrs);
-  pango_attr_list_unref (attrs);
+  gtk_widget_add_css_class (label, "heading");
   gtk_box_append (GTK_BOX (group), label);
 
   for (i = 0; tags[i]; i++)
@@ -1400,9 +1392,10 @@ update_font_variations (void)
       gtk_label_set_xalign (GTK_LABEL (label), 0);
       gtk_widget_set_halign (label, GTK_ALIGN_START);
       gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
-      gtk_grid_attach (GTK_GRID (demo->variations_grid), label, 0, -1, 2, 1);
+      gtk_grid_attach (GTK_GRID (demo->variations_grid), label, 0, -1, 1, 1);
 
       combo = gtk_combo_box_text_new ();
+      gtk_widget_set_halign (combo, GTK_ALIGN_START);
       gtk_widget_set_valign (combo, GTK_ALIGN_BASELINE);
 
       gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "");
@@ -1419,7 +1412,7 @@ update_font_variations (void)
             }
         }
 
-      gtk_grid_attach (GTK_GRID (demo->variations_grid), combo, 1, -1, 2, 1);
+      gtk_grid_attach (GTK_GRID (demo->variations_grid), combo, 1, -1, 3, 1);
       g_signal_connect (combo, "changed", G_CALLBACK (instance_changed), NULL);
       demo->instance_combo = combo;
    }
index 77d47120ad2f40d25975d835743d753cd1644400..dc8888dfc1a8d6481f772aeed85f265423589435 100644 (file)
                           <object class="GtkLabel">
                             <property name="xalign">0</property>
                             <property name="label" translatable="yes">OpenType Features</property>
-                            <attributes>
-                              <attribute name="weight" value="bold"></attribute>
-                            </attributes>
+                            <property name="margin-top">10</property>
+                            <property name="margin-bottom">10</property>
+                            <style>
+                              <class name="title-4"/>
+                            </style>
                           </object>
                         </child>
                         <child>
                           <object class="GtkLabel" id="variations_heading">
                             <property name="label" translatable="yes">Variation Axes</property>
                             <property name="xalign">0</property>
-                            <attributes>
-                              <attribute name="weight" value="bold"></attribute>
-                            </attributes>
+                            <property name="margin-top">10</property>
+                            <property name="margin-bottom">10</property>
+                            <style>
+                              <class name="title-4"/>
+                            </style>
                           </object>
                         </child>
                         <child>